<div id="pageoptions">
    <%= link_to "< back to category list", {# link_to options
            :controller => 'category'} %>
</div>
<div class="pagination">
    <% if @story_pages.length > 1 then  %>
        <%= if !@story_pages.current.first? then link_to "&lt; Prev", :page=>@story_pages.current.previous, :params => {:category_id => @params[:category_id]} else "&lt; Prev" end  %>
         <%= pagination_links(@story_pages) %>
         <%= if !@story_pages.current.last? then link_to "Next &gt;", :page=>@story_pages.current.next, :params => {:category_id => @params[:category_id]} else "Next &gt;" end %>
    <% end %>
</div>
    <% for story in @stories %>
        <div class="sectionwrap">
            <div class="sectiontitle">
            <% if story.user_id == @session[:user].id %>
            <%= link_to "#{story.title}", {# link_to options
                                    :controller => 'story',
                                    :action => 'view',
                                    :id => story.id
                                    } %>
            <% else %>
            <%= link_to "#{story.title}", {# link_to options
                                    :controller => 'story',
                                    :action => 'view',
                                    :id => story.id,
                                    :relationship_id => story.relationship_id
                                    } %>            
            <% end %></div>
            <div class="storydates">Created: <%= h(story.created_at.strftime(" %m/%d/%Y %I:%M%p")) %>  <%= if story.updated_at then "Modified: #{h(story.updated_at.strftime(' %m/%d/%Y %I:%M%p'))}" end %></div>          
            <div class="sectionlinks">
                <ul>
                <% if story.user_id == @session[:user].id %>
                    <li><%= link_to "edit", {# link_to options
                                        :controller => 'story',
                                        :action => 'edit_story',
                                        :id => story.id
                                        } %></li>
                <% end %>
                <% if story.user_id == @session[:user].id %>
                    <li><%= link_to "list words", {# link_to options
                                :controller => 'word',
                                :action => 'story_words',
                                :id => story.id
                                } %></li>
                <% else %>
                    <li><%= link_to "list words", {# link_to options
                                :controller => 'word',
                                :action => 'shared_words',
                                :id => story.id,
                                :relationship_id => story.relationship_id
                                } %></li>
                <% end %>
                <% if story.user_id == @session[:user].id %>
                    <li><%= link_to "manage story categorys", {# link_to options
                                :controller => 'category',
                                :action => 'manage_story_categorys',
                                :id => story.id
                                } %></li>
                <% else %>
                    <li><%= link_to "manage story categorys", {# link_to options
                                :controller => 'category',
                                :action => 'manage_story_categorys',
                                :id => story.id,
                                :relationship_id => story.relationship_id
                                } %></li>
                <% end %>
                <% if story.user_id == @session[:user].id %>
                    <li><%= link_to "share story", {# link_to options
                                :controller => 'sharing',
                                :action => 'share_story',
                                :id => story.id
                                } %></li> 
                <% end %>   
                <% if story.user_id == @session[:user].id %>                
                    <li><%= link_to "delete", {# link_to options
                                    :controller => 'story',
                                    :action => 'delete',
                                    :id => story.id },
                                    { # html options
                                        :method => :post,
                                        :confirm => "Really delete #{story.title}?"
                                    } %></li>
                <% end %>
                </ul>
            </div>
            <div class="storybody">
                <%= story.body[0,1000].gsub(/\n/, "<br/>") %>
                <%= if story.body.length > 1000 then " ..." end %>
            </div>
        </div>
    <% end %>
<div class="pagination">
    <% if @story_pages.length > 1 then  %>
        <%= if !@story_pages.current.first? then link_to "&lt; Prev", :page=>@story_pages.current.previous else "&lt; Prev" end  %>
         <%= pagination_links(@story_pages) %>
         <%= if !@story_pages.current.last? then link_to "Next &gt;", :page=>@story_pages.current.next else "Next &gt;" end %>
    <% end %>
</div>